package com.board.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;

import com.board.beans.Board;
import com.board.beans.Board2;

public class BoardDao extends CommonDao {
	
	public static BoardDao getInstance() {
		BoardDao _instance = new BoardDao();
		_instance.SetDB();
		return _instance;
	}
	
	/*
	public ArrayList<Board> getArticleList() throws SQLException {
		ResultSet rs = null;
		
		String sql = "select * from BOARD order by idx desc";
		
		rs = openConnection().executeQuery(sql);
		
		ArrayList<Board> articleList = new ArrayList<Board>();
		
		while(rs.next()) {
			Board article = new Board();
			
			article.setIdx(rs.getInt("idx"));          
			article.setTitle(rs.getString("title"));
            article.setWriter(rs.getString("writer"));
            article.setRegdate(rs.getString("regdate"));
            
            articleList.add(article);
		}
		
		closeConnection();
		
		return articleList;
		
	}
	*/
	
	public ArrayList<Board2> getArticleList(int page) throws SQLException {
		
	ArrayList<Board2> articleList = null;
	articleList = (ArrayList<Board2>)GetDB().queryForList("getArticleList", null, page, 10);
	
    return articleList;
	}
	
	public Map getProc(Map m) throws SQLException {
		GetDB().queryForObject("inputProc", m);
		return m;
	}
	
	public ArrayList<Board2> getList(HashMap m) throws SQLException {
		return (ArrayList<Board2>) GetDB().queryForList("select_board", m);
		
	}
	
	/*
	public void insertArticle(Board board) throws SQLException {
		GetDB().insert("insertArticle", board);
	}
	*/
}
